/* ----------------------------------------------------------------------
 *	Shadow Quest
 *	Copyright (C) 2009 Prageeth Silva <prageeth@thenewcoders.com>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *  ----------------------------------------------------------------------
 */
package sq.game;

import units.Unit;

/** Cheats class
 * 
 */
public class Cheats {

    // local variables
    private static final double GOD_SPEED = 0.8;
    private static boolean godMode = false;
    private static double speed;

    /** Create a new Cheats object
     *
     */
    public Cheats() {
        // do nothing for now
    }

    private static double getSpeed() {
        return Cheats.speed;
    }

    private static void setSpeed(double speed) {
        Cheats.speed = speed;
    }

    /** Is the player on GOD MODE
     * @return The status of the player being on GOD MODE.
     */
    public static boolean isOnGodMode() {
        return Cheats.godMode;
    }

    private static void setGodMode(boolean godMode) {
        Cheats.godMode = godMode;
    }

    /** Apply the GOD MODE on a particular unit (usually the player)
     * @param unit The unit to which the GOD MODE should be applied.
     */
    public static void applyGodMode(Unit unit) {
        Cheats.setGodMode(true);
        Cheats.setSpeed(unit.getSpeed());
        unit.setSpeed(GOD_SPEED);
    }

    /** Remove the GOD MODE on a particular unit (usually the player)
     * @param unit The unit to which the GOD MODE should be removed from.
     */
    public static void removeGodMode(Unit unit) {
        Cheats.setGodMode(false);
        unit.setSpeed(getSpeed());
    }
}
